/*
 * @Author: peng.chen2 peng.chen2@rt-mart.com
 * @Date: 2025-07-23 10:18:48
 * @LastEditors: peng.chen2
 * @LastEditTime: 2025-07-30 19:23:46
 * @FilePath: /rt-monitoring/vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import * as path from 'path'
import svgr from 'vite-plugin-svgr'

export default defineConfig({
  plugins: [react(), svgr({ svgrOptions: { icon: true } })],
  server: {
    port: 3000,
    open: true,
    allowedHosts: true,
    host: '0.0.0.0', // 监听所有网络接口，允许外部访问
    // proxy: {
    //   '/api': {
    //     target: 'http://10.200.52.122:8080', // 后端API服务器地址
    //     changeOrigin: true,
    //     rewrite: (path) => path.replace(/^\/api/, '')
    //   },
    //   '/external': {
    //     target: 'http://10.200.52.122:8080', // 外部API服务器地址
    //     changeOrigin: true
    //   }
    // }
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
      '@components': path.resolve(__dirname, './src/components'),
      '@service': path.resolve(__dirname, './src/service'),
      '@utils': path.resolve(__dirname, './src/utils'),
      '@assets': path.resolve(__dirname, './src/assets'),
      '@hooks': path.resolve(__dirname, './src/hooks'),
      '@pages': path.resolve(__dirname, './src/pages'),
      '@styles': path.resolve(__dirname, './src/styles'),
    },
  },
  build: {
    outDir: 'dist',
    sourcemap: true,
  },
})
